<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Alterar Usuarios</title>
        <script type="text/javascript" src="../js/jquery.js" ></script>
        <script type="text/javascript" src="../js/jquery.validate.js"></script>
        <script type="text/javascript" src="../js/forms.js"></script>
        <script type="text/javascript" src="../js/jquery-ui-1.8.2.custom.min.js" ></script>
        <link rel="stylesheet" href="../css/ui-lightness/jquery-ui-1.8.2.custom.css">
    <link rel="stylesheet" href="../css/forms.css"></head>
    <script>$(document).ready(function(){
        $("#form").validate({
            rules: {
                id_perfil: {required: true,digits: true
                }
                ,nome_usuario: {required: true}
                ,login_usuario: {required: true}
                ,senha_usuario: {required: true}
                ,email_usuario: {required: true}
            },
            submitHandler: function(form) {
                salvar(form);
            }
        });
    });
    </script>


    <body>

        <form name="form" id="form" method="post" action="update_senha.jsp" >
            <div id="formulario">
                <fieldset><legend>Alteração de senha</legend>
                    <sql:query var="query" dataSource="jdbc/dbo_MicrosoftSQLServer">SELECT  * FROM Usuarios where id_usuario=?
                        <sql:param value="${sessionScope.id_usuario}"/>
                    </sql:query>
                    <c:forEach var="row" items="${query.rows}">
                        <input type="hidden" name="id_usuario" size="10" maxlength="10" class="required" value="${row.id_usuario}">                        
                        <p><label class="lbInput">Nome</label>
                            <input type="text" name="nome_usuario" size="100" maxlength="100" readonly value="${row.nome_usuario}">
                        </p>
                        <p><label class="lbInput">Login</label>
                            <input type="text" name="login_usuario" size="30" maxlength="30" readonly value="${row.login_usuario}">
                        </p>                      
                        <p><label class="lbInput">Email</label>
                            <input type="text" name="email_usuario" size="60" maxlength="60" readonly value="${row.email_usuario}">
                        </p>
                        <p><label class="lbInput">Nova senha</label>
                            <input type="password" name="senha_usuario" size="10" maxlength="10" >
                        </p>
                    </c:forEach><p>
                        <input class="submit" type="submit" value="Salvar">
                    </p>
                    <div id="ajax_dados" style="display:block">
                    </div>
                    <div id="msg" style="display:none"></div>
                </fieldset>
            </div>
        <input type="hidden" id="token" name="token" value="${sessionScope.token}" /> </form>
    </body>
</html>
